package com.oco.service.user;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.oco.mybatis.dao.UserMapper;
import com.oco.mybatis.domain.User;

@Service
public class UserServiceImpl implements UserService {

	@Resource
	private UserMapper userMapper;
	
	public List<User> selectAll(User userWhere) {
		return userMapper.select(userWhere);
	}
	
	public List<User> findUserList() {
		return userMapper.findUserList();
	}
	
	public List<User> findUserByUserList(Map<String, Object> whereMap) {
		return userMapper.findUserByUserList(whereMap);
	}
	
	@Transactional(rollbackFor=Exception.class)
	public int save(User user) {
		return userMapper.insert(user);
	}
	
	@Transactional(rollbackFor=Exception.class)
	public int update(User user) {
		return  userMapper.updateByPrimaryKey(user);
	}
	
	@Transactional(rollbackFor=Exception.class)
	public int delete(User user) {
		return userMapper.delete(user);
	}
	
}
